home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
et
/
et3_0-a1.lha
/
et3
/
src
/
CollView.h
< prev
next >
Wrap
C/C++ Source or Header
|
1992-07-16
|
3KB
|
110 lines
#ifndef CollView_First
#ifdef __GNUG__
//pragma once
#pragma interface
#endif
#define CollView_First
#include "View.h"
class SeqCollection;
//---- CollectionView options --------------------------------------------------
enum CollViewOptions {
eCVGrid = BIT(eViewLast+1),
eCVDontStuckToBorder= BIT(eViewLast+2),
eCVExpandRows = BIT(eViewLast+3),
eCVExpandCols = BIT(eViewLast+4),
eCVModified = BIT(eViewLast+5),
eCVDefault = 0,
eCVLast = eViewLast + 5
};
//---- CollectionView ----------------------------------------------------------
class CollectionView: public View {
protected:
SeqCollection *coll;
Rectangle selection;
Point gap, minExtent;
int *xPos, *yPos, rows, cols;
VObject *defaultItem;
public:
MetaDef(CollectionView);
CollectionView(EvtHandler*, SeqCollection*, CollViewOptions o= eCVDefault,
int r= 0, int c= 1);
~CollectionView();
void SetCollection(SeqCollection*, bool freeold= TRUE);
SeqCollection *GetCollection()
{ return coll; }
void SetDefaultItem(VObject *d);
void SetColsRows(Point cr);
//---- layout
void SetMinExtent(Point);
Metric GetMinSize();
void SetOrigin(Point at);
void SetGap(Point g)
{ gap= g; }
void Update();
void Open(bool m);
//---- drawing
void Draw(Rectangle);
virtual void DrawGrid(Point from, Point to);
//---- event handling
Command *DoLeftButtonDownCommand(Point, Token, int);
Command *DoKeyCommand(int, Token);
virtual void DoSelect(Rectangle sel, int clicks);
VObject *Detect(BoolFun find, void *arg);
//---- updating (change propagation)
void DoObserve(int, int, void*, Object*);
void Modified();
//---- selection
Rectangle GetSelection()
{ return selection; }
void SetSelection(Rectangle, bool sendcontrol= FALSE);
void ClearSelection(bool redraw= TRUE);
//---- mapping
Point PointToItem(Point, bool *outside= 0);
Rectangle ItemRect(int, int);
VObject *GetItem(int x, int y);
Point ItemPos(VObject *);
Rectangle ItemRect(Rectangle r);
void InvalidateItemRect(Rectangle r)
{ InvalidateRect(ItemRect(r)); }
void ConstrainScroll(Point*);
//---- input/output
OStream& PrintOn(OStream&);
IStream& ReadFrom(IStream&);
bool PrintOnWhenObserving(Object*);
//---- inspecting
void CollectParts(Collection*);
};
//---- CellSelector ------------------------------------------------------------
class CellSelector: public Command {
CollectionView *lvp;
VObject *itemptr, *last;
Point item;
bool dontstuck;
public:
CellSelector(CollectionView*, bool dontstucktoborder);
void TrackFeedback(Point, Point, bool);
Command *TrackMouse(TrackPhase, Point, Point, Point);
};
#endif